<!-- This comment will put IE 6, 7 and 8 in quirks mode -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>shark::MergeBudgetMaintenanceStrategy&lt; InputType &gt; Class Template Reference</title>
<script type="text/javaScript" src="search/search.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3.0.1/es5/tex-mml-chtml.js"></script>
<script src="../../mlstyle.js"></script>
<link href="../css/besser.css" rel="stylesheet" type="text/css"/>
</head>
<!-- pretty cool: each body gets an id tag which is the basename of the web page  -->
<!--              and allows for page-specific CSS. this is client-side scripted, -->
<!--              so the id will not yet show up in the served source code -->
<script type="text/javascript">
    jQuery(document).ready(function () {
        var url = jQuery(location).attr('href');
        var pname = url.substr(url.lastIndexOf("/")+1, url.lastIndexOf(".")-url.lastIndexOf("/")-1);
        jQuery('#this_url').html('<strong>' + pname + '</strong>');
        jQuery('body').attr('id', pname);
    });
</script>
<body>
    <div id="shark_old">
        <div id="wrap">
            <div id="header">
                <div id="site-name"><a href="../../sphinx_pages/build/html/index.html">Shark machine learning library</a></div>
                <ul id="nav">
                    <li >
                        <a href="../../sphinx_pages/build/html/rest_sources/installation.html">Installation</a>
                    </li>
		    <li >
                        <a href="../../sphinx_pages/build/html/rest_sources/tutorials/tutorials.html">Tutorials</a>
                    </li>
		    <li >
                        <a href="../../sphinx_pages/build/html/rest_sources/benchmark.html">Benchmarks</a>
                    </li>
                    <li class="active">
                        <a href="classes.html">Documentation</a>
                        <ul>
                            <li class="first"></li>
                            <li><a href="../../sphinx_pages/build/html/rest_sources/quickref/quickref.html">Quick references</a></li>
                            <li><a href="classes.html">Class list</a></li>
                            <li class="last"><a href="group__shark__globals.html">Global functions</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </div>
<div id="doxywrapper">
<!--
    <div id="global_doxytitle">Doxygen<br>Documentation:</div>
-->
    <div id="navrow_wrapper">
<!-- Generated by Doxygen 1.9.8 -->
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespaceshark.html">shark</a></li><li class="navelem"><a class="el" href="classshark_1_1_merge_budget_maintenance_strategy.html">MergeBudgetMaintenanceStrategy</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="classshark_1_1_merge_budget_maintenance_strategy-members.html">List of all members</a>  </div>
  <div class="headertitle"><div class="title">shark::MergeBudgetMaintenanceStrategy&lt; InputType &gt; Class Template Reference</div></div>
</div><!--header-->
<div class="contents">

<p>Budget maintenance strategy that merges two vectors.  
 <a href="classshark_1_1_merge_budget_maintenance_strategy.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="_merge_budget_maintenance_strategy_8h_source.html">shark/Algorithms/Trainers/Budgeted/MergeBudgetMaintenanceStrategy.h</a>&gt;</code></p>
<div id="dynsection-0" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-0-trigger" src="closed.png" alt="+"/> Inheritance diagram for shark::MergeBudgetMaintenanceStrategy&lt; InputType &gt;:</div>
<div id="dynsection-0-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-0-content" class="dyncontent" style="display:none;">
<div class="center"><img src="classshark_1_1_merge_budget_maintenance_strategy__inherit__graph.png" border="0" usemap="#ashark_1_1_merge_budget_maintenance_strategy_3_01_input_type_01_4_inherit__map" alt="Inheritance graph"/></div>
<map name="ashark_1_1_merge_budget_maintenance_strategy_3_01_input_type_01_4_inherit__map" id="ashark_1_1_merge_budget_maintenance_strategy_3_01_input_type_01_4_inherit__map">
<area shape="rect" title="Budget maintenance strategy that merges two vectors." alt="" coords="12,94,224,135"/>
<area shape="rect" href="classshark_1_1_abstract_budget_maintenance_strategy.html" title="This is the abstract interface for any budget maintenance strategy." alt="" coords="5,5,231,46"/>
<area shape="poly" title=" " alt="" coords="121,62,121,94,115,94,115,62"/>
</map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="inherited" name="inherited"></a>
Additional Inherited Members</h2></td></tr>
<tr class="inherit_header pub_types_classshark_1_1_abstract_budget_maintenance_strategy"><td colspan="2" onclick="javascript:toggleInherit('pub_types_classshark_1_1_abstract_budget_maintenance_strategy')"><img src="closed.png" alt="-"/>&#160;Public Types inherited from <a class="el" href="classshark_1_1_abstract_budget_maintenance_strategy.html">shark::AbstractBudgetMaintenanceStrategy&lt; InputType &gt;</a></td></tr>
<tr class="memitem:a2fce0a0656e77df1f5e54bea0d3c9f6b inherit pub_types_classshark_1_1_abstract_budget_maintenance_strategy" id="r_a2fce0a0656e77df1f5e54bea0d3c9f6b"><td class="memItemLeft" align="right" valign="top">typedef <a class="el" href="classshark_1_1_kernel_expansion.html">KernelExpansion</a>&lt; <a class="el" href="_multi_task_svm_8cpp.html#a0dea9a3a85d327080d9b617903508925">InputType</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classshark_1_1_abstract_budget_maintenance_strategy.html#a2fce0a0656e77df1f5e54bea0d3c9f6b">ModelType</a></td></tr>
<tr class="separator:a2fce0a0656e77df1f5e54bea0d3c9f6b inherit pub_types_classshark_1_1_abstract_budget_maintenance_strategy"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7027102ef6150ec0de810886b8098718 inherit pub_types_classshark_1_1_abstract_budget_maintenance_strategy" id="r_a7027102ef6150ec0de810886b8098718"><td class="memItemLeft" align="right" valign="top">typedef <a class="el" href="classshark_1_1_labeled_data.html">LabeledData</a>&lt; <a class="el" href="_multi_task_svm_8cpp.html#a0dea9a3a85d327080d9b617903508925">InputType</a>, unsigned int &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classshark_1_1_abstract_budget_maintenance_strategy.html#a7027102ef6150ec0de810886b8098718">DataType</a></td></tr>
<tr class="separator:a7027102ef6150ec0de810886b8098718 inherit pub_types_classshark_1_1_abstract_budget_maintenance_strategy"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4e4e18bcc754402146beb894a7c3d7cd inherit pub_types_classshark_1_1_abstract_budget_maintenance_strategy" id="r_a4e4e18bcc754402146beb894a7c3d7cd"><td class="memItemLeft" align="right" valign="top">typedef DataType::element_type&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classshark_1_1_abstract_budget_maintenance_strategy.html#a4e4e18bcc754402146beb894a7c3d7cd">ElementType</a></td></tr>
<tr class="separator:a4e4e18bcc754402146beb894a7c3d7cd inherit pub_types_classshark_1_1_abstract_budget_maintenance_strategy"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_classshark_1_1_abstract_budget_maintenance_strategy"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classshark_1_1_abstract_budget_maintenance_strategy')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="classshark_1_1_abstract_budget_maintenance_strategy.html">shark::AbstractBudgetMaintenanceStrategy&lt; InputType &gt;</a></td></tr>
<tr class="memitem:a2a6d7afdbb1e6dc61f86619dd526a544 inherit pub_methods_classshark_1_1_abstract_budget_maintenance_strategy" id="r_a2a6d7afdbb1e6dc61f86619dd526a544"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classshark_1_1_abstract_budget_maintenance_strategy.html#a2a6d7afdbb1e6dc61f86619dd526a544">AbstractBudgetMaintenanceStrategy</a> ()</td></tr>
<tr class="separator:a2a6d7afdbb1e6dc61f86619dd526a544 inherit pub_methods_classshark_1_1_abstract_budget_maintenance_strategy"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a763d8224ee45bb2bb727cb05ac002b94 inherit pub_methods_classshark_1_1_abstract_budget_maintenance_strategy" id="r_a763d8224ee45bb2bb727cb05ac002b94"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classshark_1_1_abstract_budget_maintenance_strategy.html#a763d8224ee45bb2bb727cb05ac002b94">addToModel</a> (<a class="el" href="classshark_1_1_abstract_budget_maintenance_strategy.html#a2fce0a0656e77df1f5e54bea0d3c9f6b">ModelType</a> &amp;model, <a class="el" href="_multi_task_svm_8cpp.html#a0dea9a3a85d327080d9b617903508925">InputType</a> const &amp;alpha, <a class="el" href="classshark_1_1_abstract_budget_maintenance_strategy.html#a4e4e18bcc754402146beb894a7c3d7cd">ElementType</a> const &amp;supportVector)=0</td></tr>
<tr class="separator:a763d8224ee45bb2bb727cb05ac002b94 inherit pub_methods_classshark_1_1_abstract_budget_maintenance_strategy"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa96771736bedb9e44f820e871ed98350 inherit pub_methods_classshark_1_1_abstract_budget_maintenance_strategy" id="r_aa96771736bedb9e44f820e871ed98350"><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classshark_1_1_abstract_budget_maintenance_strategy.html#aa96771736bedb9e44f820e871ed98350">name</a> () const</td></tr>
<tr class="memdesc:aa96771736bedb9e44f820e871ed98350 inherit pub_methods_classshark_1_1_abstract_budget_maintenance_strategy"><td class="mdescLeft">&#160;</td><td class="mdescRight">return the class name  <br /></td></tr>
<tr class="separator:aa96771736bedb9e44f820e871ed98350 inherit pub_methods_classshark_1_1_abstract_budget_maintenance_strategy"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_static_methods_classshark_1_1_abstract_budget_maintenance_strategy"><td colspan="2" onclick="javascript:toggleInherit('pub_static_methods_classshark_1_1_abstract_budget_maintenance_strategy')"><img src="closed.png" alt="-"/>&#160;Static Public Member Functions inherited from <a class="el" href="classshark_1_1_abstract_budget_maintenance_strategy.html">shark::AbstractBudgetMaintenanceStrategy&lt; InputType &gt;</a></td></tr>
<tr class="memitem:ab6ab9d070c0988b041e96e66888a1841 inherit pub_static_methods_classshark_1_1_abstract_budget_maintenance_strategy" id="r_ab6ab9d070c0988b041e96e66888a1841"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classshark_1_1_abstract_budget_maintenance_strategy.html#ab6ab9d070c0988b041e96e66888a1841">findSmallestVector</a> (<a class="el" href="classshark_1_1_abstract_budget_maintenance_strategy.html#a2fce0a0656e77df1f5e54bea0d3c9f6b">ModelType</a> const &amp;model, size_t &amp;minIndex, double &amp;minAlpha)</td></tr>
<tr class="separator:ab6ab9d070c0988b041e96e66888a1841 inherit pub_static_methods_classshark_1_1_abstract_budget_maintenance_strategy"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><div class="compoundTemplParams">template&lt;class <a class="el" href="_multi_task_svm_8cpp.html#a0dea9a3a85d327080d9b617903508925">InputType</a>&gt;<br />
class shark::MergeBudgetMaintenanceStrategy&lt; InputType &gt;</div><p>Budget maintenance strategy that merges two vectors. </p>
<dl class="section user"><dt>This is an budget strategy that simply merges two budget vectors</dt><dd>in order to make space for a new one. This is done by first searching for the budget vector that has smallest <p class="formulaDsp">
\[ ||\alpha||_2\]
</p>
 coefficient&ndash; only then a second one is searched for, by inspecting the expected weight degradation after merging. The vector with smallest weight degradation is the vector one should merge with the first one. By this heuristic, the merging strategy has complexity <p class="formulaDsp">
\[ \mathcal{O}(B) \]
</p>
. Compared with the projection strategy, merging should be faster, and stil obtains similar accuracy. Unluckily any kind of timing numbers are missing in the reference paper of Wang, Crammer and Vucetic.</dd></dl>
<dl class="section user"><dt>Note that in general it is unclear how two data objects should be merged,</dt><dd>e.g. strings must be merged differently than vectors. Therefore it is necessary to create an specialization of this strategy for a given input type. </dd></dl>

<p class="definition">Definition at line <a class="el" href="_merge_budget_maintenance_strategy_8h_source.html#l00083">83</a> of file <a class="el" href="_merge_budget_maintenance_strategy_8h_source.html">MergeBudgetMaintenanceStrategy.h</a>.</p>
</div><hr/>The documentation for this class was generated from the following file:<ul>
<li>include/shark/Algorithms/Trainers/Budgeted/<a class="el" href="_merge_budget_maintenance_strategy_8h_source.html">MergeBudgetMaintenanceStrategy.h</a></li>
</ul>
</div><!-- contents -->
</div>
</body>
</html>
